package pro.softzhang.algo.lc1000;

import pro.softzhang.algo.flag.book.BDaily;

@BDaily
public class LC1003_CheckIfWordIsValidAfterSubstitutions {
    public static void main(String[] args) {
        String s = "aabcbcc";
        System.out.println(new Solution().isValid(s));
    }

    /**
     * 只要能一直替换abc直到""，就行。
     */
    static
    class Solution {
        public boolean isValid(String s) {
            for(String t = s; t.length() != 0; s = t) {
                t = s.replace("abc", "");
                if(t.equals(s)) return false;
            }
            return true;
        }
    }
}
